﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using Platform.Infrastructure;

namespace Platform.ObjectModel.Validation
{

	//public class ValidationMessage : DataObjectFlake
	//{
	//	public ValidationMessage( string message )
	//		: this( null, message )
	//	{ }

	//	public ValidationMessage( DataObjectName name, string errorMessage )
	//	{
	//		this.QualifiedName = name;
	//		this.ErrorMessage = errorMessage;
	//	}

	//	public DataObjectName QualifiedName
	//	{ get; private set; }

	//	public string ErrorMessage
	//	{ get; private set; }
	//}

	/// <summary>
	/// Exceção enviada para informar que houve um erro de validação
	/// </summary>
	[Serializable]
	public class ValidationException : Exception
	{
		public ValidationException( string message )
			: base( message )
		{ }
		
		public ValidationException( DataObjectName name, string message )
			: base( message )
		{
			Arguments.IsNotNull( "name", name );
			this.QualifiedName = name;
		}

		public ValidationException( string message, Exception innerException )
			: base( message, innerException )
		{ }

		protected ValidationException( SerializationInfo info, StreamingContext context )
			: base( info, context )
		{ }



		public DataObjectName QualifiedName
		{ get; private set; }
	}
}
